<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <script>
                function title() {
                    document.getElementById('admin').className='selected';
                }
                window.onload=title;
            </script>
            <h:form id="incomeCreate" enctype="multipart/form-data">
                <h1 class="title">
                    <a href="#" class="back" onclick="history.go(-1)"/>
                    Transferência entre Contas
                </h1>
                <p:messages showDetail="true" autoUpdate="true"  /> 
                <div class="row">
                    <div class="twelve columns">
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Cadastrar</h4></legend>
                            <p:panel id="resultPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix " >
                                <p:outputLabel value="Conta Origem:" for="banco" styleClass="grid_4"/>
                                <p:autoComplete id="banco"  value="#{managerCash.contaBancariaOrigem}" 
                                                styleClass="grid_10" required="true"
                                                var="item1" forceSelection="true" dropdown="true" 
                                                minQueryLength="3" itemValue="#{item1}" itemLabel="#{item1}" 
                                                panelStyle="max-height:200px;"  
                                                completeMethod="#{managerCash.autocompleteContaBancarias}" 
                                                converter="contabancariaconverter">
                                </p:autoComplete>
                                <div class="clear"/>

                                <p:outputLabel value="Conta Destino:" for="bancodestino" styleClass="grid_4"/>
                                <p:autoComplete id="bancodestino"  value="#{managerCash.contaBancaria}" 
                                                styleClass="grid_10" required="true"
                                                var="item1" forceSelection="true" dropdown="true" 
                                                minQueryLength="3" itemValue="#{item1}" itemLabel="#{item1}" 
                                                panelStyle="max-height:200px;"  
                                                completeMethod="#{managerCash.autocompleteContaBancarias}" 
                                                converter="contabancariaconverter">
                                </p:autoComplete>
                                <div class="clear"/>

                                <p:outputLabel for="famount" value="Valor:" styleClass="grid_4"/>  
                                <p:inputText id="famount" styleClass="grid_5" required="true"
                                             requiredMessage="O campo 'valor' é necessário"
                                             value="#{managerCash.cash.value}"
                                             onkeypress="jQuery(this).autoNumeric({aSign:'R$ ',aSep: '.', aDec: ','} );">
                                    <f:convertNumber type="currency" locale="pt,BR"/>
                                </p:inputText>

                                <div class="clear"/>

                                <p:outputLabel value="Data:" for="date" styleClass="grid_4"/>  
                                <div class="grid_5">
                                    <p:calendar id="date" required="true" value="#{managerCash.cash.creatAt}" 
                                                showOn="button" pattern="dd/MM/yyyy"/>
                                </div>

                                <div class="clear"/>
                                <p:outputLabel value="Descrição:" styleClass="grid_4"/>  
                                <p:inputTextarea value="#{managerCash.cash.description}" styleClass="grid_19" />

                                <div class="clear"/>
                                
                                <div class="buttonAction">
                                    <p:commandButton value="Transferir" icon="ui-icon-disk" process="@form"
                                                     update="@form"
                                                     actionListener="#{managerCash.transferir()}" />
                                </div>

                            </p:panel>
                        </fieldset>
                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>

